package com.edu.control.deploy.retrytask;

import java.io.Serializable;
import java.util.Date;

/**
 * 重试实体
 **/
public class RetryBean implements Serializable {

    public RetryBean() {
        this.createTime = new Date();
    }

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 下次重试时间
     **/
    private Date nextRetryTime;

    /**
     * 推送次数
     **/
    private Integer retryTimes = 0;

    /**
     * 限制推送次数
     **/
    private Integer leastRetryTimes = 50;

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getNextRetryTime() {
        return nextRetryTime;
    }

    public void setNextRetryTime(Date nextRetryTime) {
        this.nextRetryTime = nextRetryTime;
    }

    public Integer getRetryTimes() {
        return retryTimes;
    }

    public void setRetryTimes(Integer retryTimes) {
        this.retryTimes = retryTimes;
    }

    public Integer getLeastRetryTimes() {
        return leastRetryTimes;
    }

    public void setLeastRetryTimes(Integer leastRetryTimes) {
        this.leastRetryTimes = leastRetryTimes;
    }

    public boolean hasChance() {
        return this.retryTimes < leastRetryTimes;
    }

    public void reduceChange() {
        this.retryTimes++;
    }

}
